<?php

namespace App\Entity\Lang;

use ApiPlatform\Core\Annotation\ApiResource;
use App\Base\Annotation\Common;
use App\Repository\Lang\TranslationRepository;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation\Groups;

/**
 * @ApiResource()
 * @ORM\Entity(repositoryClass=TranslationRepository::class)
 */
class Translation
{
    /**
     * @Common(cnName="#",listType="text",editType="text")
     * @ORM\Id()
     * @ORM\GeneratedValue()
     * @ORM\Column(type="integer")
     * @Groups({"lang"})
     */
    private $id;

    /**
     * @Common(cnName="页面",listType="text",editType="text")
     * @ORM\ManyToOne(targetEntity=LangPage::class, inversedBy="translate")
     * @Groups({"lang"})
     */
    private $page;

    /**
     * @Common(cnName="键",listType="text",editType="text",width="200")
     * @ORM\Column(type="string", length=255)
     * @Groups({"lang"})
     */
    private $k;

    /**
     * @Common(cnName="值",listType="text",editType="text",width="")
     * @ORM\Column(type="text", nullable=true)
     * @Groups({"lang"})
     */
    private $v;

    /**
     * @Common(cnName="备注",listType="text",editType="text",width="")
     * @ORM\Column(type="string", length=255, nullable=true)
     * @Groups({"lang"})
     */
    private $tips;

    public function getId(): ?int
    {
        return $this->id;
    }

    public function getPage(): ?LangPage
    {
        return $this->page;
    }

    public function setPage(?LangPage $page): self
    {
        $this->page = $page;

        return $this;
    }

    public function getK(): ?string
    {
        return $this->k;
    }

    public function setK(string $k): self
    {
        $this->k = $k;

        return $this;
    }

    public function getV(): ?string
    {
        return $this->v;
    }

    public function setV(?string $v): self
    {
        $this->v = $v;

        return $this;
    }

    public function getTips(): ?string
    {
        return $this->tips;
    }

    public function setTips(?string $tips): self
    {
        $this->tips = $tips;

        return $this;
    }
}
